/**
 * 工程名：COMMON
 * 包名：com.mt.common.safe
 * 文件名：MENU.java
 */
package com.mt.system.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.mt.component.domain.Common;
import com.mt.utils.StringUtils;



/**
 * 类名称：Menu <br>
 * 类描述：系统菜单 <br>
 * 创建人： 马腾 <br>
 * 创建时间：2012-10-18 下午11:31:18 <br>
 */
@Entity
@Table(name="CFG_SYS_MENU")
public class Menu extends Common implements Serializable {
	
	private static final long serialVersionUID = 5025197601927747360L;
	
	private String name;//模块名称
	private String desc;//模块描述
	private String icon;//图片名称或路径
	private String shortcutKey;//快捷键
	private Integer sn;//排序
	private Integer level;
	private String action;//menu的去向
	
	@Column(name = "MENU_NAME",length = 32 , nullable=false)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name = "MENU_DESC",length = 128)
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	@Column(name = "MENU_ICON",length = 128)
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	
	@Column(name = "MENU_SHORT_KEY",length = 4)
	public String getShortcutKey() {
		return shortcutKey;
	}
	public void setShortcutKey(String shortcutKey) {
		this.shortcutKey = shortcutKey;
	}
	
	@Column(name = "MENU_SN",length = 4)
	public Integer getSn() {
		return sn;
	}
	public void setSn(Integer sn) {
		this.sn = sn;
	}
	
	@Column(name = "MENU_LEVEL",length = 4)
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	
	@Column(name = "MENU_ACTION",length = 256)
	public String getAction() {
		return action;
	}
	
	public void setAction(String action) {
		this.action = action;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Menu){
			Menu menu = (Menu)obj;
			if(StringUtils.isEmpty(menu.getId())) return false;
			return menu.getId().equals(getId());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return getId()==null ? 0 : getId().hashCode();
	}
}
